跳到主要内容

CreateHyperlink

Creates a new hyperlink text block to be inserted to the current paragraph or table.

Syntax

expression.CreateHyperlink(link, display, screenTipText);

expression - A variable that represents a Api class.

Parameters

NameRequired/OptionalData typeDefaultDescription
linkRequiredstringThe hyperlink address.
displayRequiredstringThe text to display the hyperlink.
screenTipTextRequiredstringThe screen tip text.

Returns

ApiHyperlink

Example

This example creates hyperlink and pastes it into the document.

let doc = Api.GetDocument();
let paragraph = doc.GetElement(0);
let hyperlink = Api.CreateHyperlink("https://api.onlyoffice.com/", "ONLYOFFICE Document Builder", "ONLYOFFICE for developers");
paragraph.AddElement(hyperlink, 0);
paragraph.AddLineBreak();
paragraph.AddText("Class type of the created object: " + hyperlink.GetClassType());